package tool;

import java.io.*;


/**
 * Created by yangxianming on 2015-06-04.
 */
public class MyIo {
    public static byte[] dump(InputStream inputStream) throws IOException{
        try(InputStream input = inputStream){
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            byte[] data = new byte[512];
            int length = 0;
            while ((length = input.read(data)) != -1){
                bos.write(data);
            }
            bos.close();
            return bos.toByteArray();
        }
    }
}
